home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / Action Atom Samples / CustomFolderIconAA / CustomFoldIconInstall.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  7.9 KB  |  215 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: simple installation (Supports Easy and Custom Installation)
  6.  *
  7.  *    File:        CustomFoldIconInstall.r -    Rez Source
  8.  *    Description: Custom folder icons result when there is a file of name "Icon\n" in a
  9.  *                    folder, whose finder info flags have the "Use Custom Icon" bit set
  10.  *                    Additionally, the "Icon\n" file contains an 'icl4', 'icl8', 'ICN#,
  11.  *                    'ics#', 'ics4', and 'ics8' resource each with ID -16455.  Normally
  12.  *                    the icon file has the invisible bit set.  In this sample, the 
  13.  *                    Icon file is installed using an 'infa' file atom.  The invisible bit
  14.  *                    remains set during the install.  A post-installation action atom
  15.  *                    is then called being passed the resource ID of the 'infs' file
  16.  *                    spec for the target icon.  The code resource strips the file name
  17.  *                    and uses File Manager calls to get and set the Finder info for the 
  18.  *                    folder.
  19.  *
  20.  *    by:            Rich Kubota
  21.  *    modifications:
  22.  *                rrk - 5/19/93 modified target file atoms to show that the date
  23.  *                        time stamp field must be zero, and that the file/creator
  24.  *                        should not match. Also use InstallerCommon.r file 
  25.  *                rrk - 9/8/92 updated the inaa resource to format1 from format0
  26.  *                        added the "continueBusyCursors" flag to the inaa.
  27.  *
  28.  *    Copyright © 1992 Apple Computer, Inc.
  29.  *    All rights reserved.
  30.  *
  31.  *------------------------------------------------------------------------------
  32.  *
  33.  * Install application "TeachText" into the folder "Root":Installed Application.
  34.  * It demonstrates how to implement a Custom Folder Icon.  
  35.  *----------------------------------------------------------------------------*/
  36.  
  37. #include "Types.r"                    /* for the ICON resource */
  38. #include "InstallerTypes.r"
  39. #include "InstallerCommon.r"        /* list of macros to simplify list */
  40.  
  41. /* You can build and complete the script with the following lines:
  42. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  43. # or set up folders with the same names and contents as the floppies
  44. # put these folders in the same folder as the script or at the root directory of same disk
  45.  
  46.     rez -o "CustomFoldIconInstall" -t 'bbkr' -c 'bbkr' "CustomFoldIconInstall.r"
  47.     setfile -a i "CustomFoldIconInstall"        #mark Inited
  48.     scriptcheck -p "CustomFoldIconInstall"
  49. */
  50.  
  51. /* Definitions for the rules */
  52. #define rlInstallProgram        1000
  53.  
  54. /* Defines for the file spec atoms (specifications for source and destination files) */
  55. #define fsSourceProgram            2000
  56. #define fsTargetProgram            2001
  57. #define fsSourceIcon            2002
  58. #define fsTargetIcon            2003
  59.  
  60. /* This is the name of the source disk */
  61. #define ProgramDisk "Program Disk:"
  62.  
  63. /* where we want to install our file. */
  64. #define TargetPath    ":Installed Application:"
  65.  
  66. /* Definition for the package. */
  67. #define pkTheProgram            3000
  68.  
  69. /* Definition for the file atom */
  70. #define faProgram                4000
  71. #define faIcon                    4001
  72.  
  73. /* Definition for the package comment resource */
  74. #define cmtTheProgram            5000
  75.  
  76. /* Definitions for the action atom resources */
  77. #define aaSetFolderIcon            6000
  78.  
  79. /* 'inaa' code resource definition */
  80. #define        aaCodeID            10000
  81.  
  82. /* May 19, 1993 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  83. /* this value to a LongInt seconds value needed by the Installer. */
  84. #define currentReleaseDate        5191993    
  85. #define currentVersion            102     /* Version 1.0.2 goes in the 'icmt' rsrc */
  86.  
  87. #define iconTheProgram            5100
  88.  
  89. /************************** Easy Install Rule resources **********************************/
  90. resource 'infr' (1) {
  91.     format0  {{
  92.         pickFirst,    {rlInstallProgram},     /* Only one rule */
  93.     }};
  94. };
  95.  
  96. resource 'inrl' (rlInstallProgram) {
  97.     format0 {{
  98.         addUserDescription {"Click Install to install\n"},    /* message to appear in Easy Install screen */
  99.         addUserDescription {"The Program in custom folder\n"},    /* message to appear in Easy Install screen */
  100.         addPackages {{pkTheProgram}}            /* we're installing the program */
  101.     }};
  102. };
  103.  
  104. /***************************** Package Resources ************************************************/
  105. resource 'inpk' (pkTheProgram) {
  106.     format0 {
  107.         showsOnCustom,                 /* Package appears in the Custom Install display */
  108.         removable,                    /* Package can be removed */
  109.         dontForceRestart,            /* no need to reboot after live install */
  110.         cmtTheProgram,                 /* package's 'icmt' resource id */
  111.         0,                            /* Package size (filled in by ScriptCheck) */
  112.         "TheProgram", {                /* package name for package that shows on custom */
  113.             'infa', faProgram;
  114.             'infa', faIcon;
  115.             'inaa', aaSetFolderIcon;
  116.         }
  117.     }
  118. };
  119.  
  120. /***************************** Comments ************************************************/
  121. resource 'icmt' (cmtTheProgram) {
  122.     currentReleaseDate,
  123.     currentVersion,
  124.     iconTheProgram,
  125.     "This package installs TeachText in a folder with a custom icon. "
  126. };
  127.  
  128. resource 'ICON' (iconTheProgram) {
  129.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  130.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  131.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  132.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  133.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  134.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  135.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  136.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  137. };
  138.  
  139.  
  140. /********************************************* File Specs ******************************************/
  141. /* Source File Specs */
  142. resource 'infs' (fsSourceProgram) {
  143.     'APPL',                                /* File Type */
  144.     'ttxt',                                /* Creator */
  145.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  146.     noSearchForFile,                    /* Do not search the source disk for the file */
  147.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  148.     ProgramDisk"TeachText"                /* Path to the file */
  149. };
  150.  
  151. resource 'infs' (fsSourceIcon) {
  152.     '    ',                                /* File Type */
  153.     '    ',                                /* Creator */
  154.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  155.     noSearchForFile,                    /* Do not search the source disk for the file */
  156.     typeCrNeedNotMatch,                    /* file type and creator on source disk must match */
  157.     ProgramDisk"Icon Folder:Icon\n"        /* Path to the file */
  158. };
  159.  
  160. /* Target File Specs */
  161. resource 'infs' (fsTargetProgram) {
  162.     'APPL',                                /* File Type */
  163.     'ttxt',                                /* Creator */
  164.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  165.     noSearchForFile,                    /* Do not search the target disk for the file */
  166.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  167.     TargetPath"TeachText"                /* destination Path */
  168. };
  169. resource 'infs' (fsTargetIcon) {
  170.     '    ',                                /* File Type */
  171.     '    ',                                /* Creator */
  172.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  173.     noSearchForFile,                    /* Do not search the target disk for the file */
  174.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  175.     TargetPath"Icon\n"                    /* destination Path */
  176. };
  177.  
  178. /******************************************** File Atoms ************************************************/
  179. resource 'infa' (faProgram) {
  180.     format0 {
  181.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  182.         fsTargetProgram,                /* TARGET file spec for this file */
  183.         fsSourceProgram,                 /* SOURCE file spec for this file */
  184.         0,                                /* atom size (filled in by ScriptCheck) */
  185.         ""                                /* Atom Description (Installer will use file name) */
  186.     };
  187. };
  188.  
  189.  
  190. resource 'infa' (faIcon) {
  191.     format0 {
  192.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  193.         fsTargetIcon,                    /* TARGET file spec for this file */
  194.         fsSourceIcon,                     /* SOURCE file spec for this file */
  195.         0,                                /* atom size (filled in by ScriptCheck) */
  196.         ""                                /* Atom Description (Installer will use file name) */
  197.     };
  198. };
  199.  
  200. resource 'inaa'    (aaSetFolderIcon) {
  201.     format1 {
  202.         continueBusyCursors,
  203.         actAfter,
  204.         dontActOnRemove,
  205.         actOnInstall,
  206.         'infn',
  207.         aaCodeID,
  208.         fsTargetIcon,                /* pass in the 'infs' resource ID of the target folder Icon file */
  209.         "Set Locked Bit of Target file based on target infs resource ID"
  210.     }
  211. };
  212.  
  213. INCLUDE    "SetFolderIcon.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  214.  
  215.